<?php
/**
 * Created by PhpStorm.
 * Author: 芸签cms www.yunqiancms.com
 * User: sun
 * Date: 2022/6/24
 * Time: 2:00 PM
 */
namespace app\common\services;

use app\common\exceptions\BizException;

use OSS\Core\OssException;

class OssClient extends \OSS\OssClient
{
    /**
     * 上传文件OssClient->uploadFile
     * @param $bucket
     * @param $object
     * @param $file
     * @param null $options
     * @throws BizException
     */
    public function uploadFile($bucket, $object, $file, $options = NULL){
        try{
            parent::uploadFile($bucket, $object, $file,$options);
        } catch(OssException $e) {
            \Log::error("app:common:services:putObject:OssException", $e->getTraceAsString());
            throw new BizException('阿里云oss上传失败:'.$e->getMessage());
        }
    }
}